package com.longge;

public class MinDeletion {

    public int minDeletion(int[] nums) {
        int left = 0, right = 1;

        int ans = 0;
        while (right < nums.length) {
            if (nums[left] != nums[right]) {
                left = right + 1;
                right += 2;
            } else if (nums[left] == nums[right]) {
                right++;
                ans++;
            }

        }
        return left == nums.length ? ans : ++ans;
    }

    public static void main(String[] args) {
        new MinDeletion().minDeletion(new int[]{1,1,2,3,5});
    }
}
